﻿<html>
<head><title>Options - Smart RSS Subscriber for Google Reader™</title></head>
<style>
	  body {
	    padding:0px;
		margin:0px;
	  }
      #main {
	    width: 800px;
		text-align:left;
		margin-top:30px;
		margin-left:30px;
	  }
      #main-text {
	    xwidth: 400px;
		text-align:left;

	  }


	  #main-title {
		float:left;
		margin-bottom:15px;
		padding-bottom:3px;
		border-bottom:1px solid #d3d3d3;
	  }
	  #main-title h3{
		float:left;
		margin-top:11px;
		margin-left:6px;
	  }
	  #icon {
		float:left;

	  }
	  h3{
		margin:0px;
		padding:0px;
		margin-top:5px;
		color:#d92583;
		font-size:24px;
		font-family:arial;
		font-weight:normal;
	  }

	  h4 {
		margin:0px;
		padding:0px;
		margin-top:12px;
		margin-bottom:6px;
		color:#d92583;
		font-size:18px;
		font-family:arial;
		font-weight:normal;
	  }
	  h5 {
		margin:0px;
		padding:0px;
		margin-top:12px;
		margin-bottom:4px;
		color:#2554d9;
		font-size:16px;
		font-family:arial;
		font-weight:normal;
	  }		
	.text {
		font-family:arial;
		font-size:13px;
		color:#2e2e2e;
	}
	#extensions {
		width:600px;
		margin-top:14px;
	}
	.extension{
		float:left;
		margin-bottom:20px;
		padding-bottom:20px;
		border-bottom:1px solid #eaeaea;
	}
	.extension .ext-icon {
		float:left;
	}
	.ext-title {
	    float:left;
		font-size:18px;
		font-family:arial;
		font-weight:normal;	
		color:#2554d9;
		margin-left:10px;
		margin-top:3px;
	}
	.description {
	    float:left;
		clear:both;
		margin-top:5px;
		font-family:arial;
		font-size:13px;
		color:#2e2e2e;	
	}
	</style>
<script type="text/javascript">
// Saves options to localStorage.
function save_options_pro() {
  var size = document.frm.pro.length;
  for (var i=0; i < size; i++) {
	if (document.frm.pro[i].checked) {
		localStorage["current_protocol"] = document.frm.pro[i].value;
		break;
	}
  }

  // Update status to let user know options were saved.
  var status = document.getElementById("status");
  status.innerHTML = "Options Saved.";
  setTimeout(function() {
    status.innerHTML = "";
  }, 750);
}

function save_options_tab() {
  var size = document.frm.tab.length;
  for (var i=0; i < size; i++) {
	if (document.frm.tab[i].checked) {
		localStorage["tab_option"] = document.frm.tab[i].value;
		break;
	}
  }

  // Update status to let user know options were saved.
  var status = document.getElementById("status");
  status.innerHTML = "Options Saved.";
  setTimeout(function() {
    status.innerHTML = "";
  }, 750);
}

function save_options_check() {
  localStorage["check_option_interval"] = document.frm.interval.value;
  
   // Update status to let user know options were saved.
  var status = document.getElementById("status");
  status.innerHTML = "Options Saved.";
  setTimeout(function() {
    status.innerHTML = "";
  }, 750);
}

function add_blacklist_item() {
	if (document.frm.addListBlack.value) {
		var blacklist = JSON.parse(localStorage["black_list"]);
		blacklist.push(document.frm.addListBlack.value);
		localStorage["black_list"] = JSON.stringify(blacklist);
		var listBox = document.getElementById("listBlack");
		listBox.options.length = 0;
		restore_blacklist();
	}
}

function del_blacklist_item() {
	var listBox = document.getElementById("listBlack");
	var blacklist = JSON.parse(localStorage["black_list"]);
	for (var i=0; i < listBox.options.length; i++) {
		if (listBox.options[i].selected) {
			for (var j=0; j < blacklist.length; j++) {
				if (listBox.options[i].value == blacklist[j]) {
					blacklist.splice(j, 1);
				}
			}
		}
	}
	
	localStorage["black_list"] = JSON.stringify(blacklist);
	var listBox = document.getElementById("listBlack");
	listBox.options.length = 0;
	restore_blacklist();
}

function restore_blacklist() {
  var blacklist;
  if (localStorage["black_list"] == undefined) {
	blacklist = new Array("http://www.google.com/reader/*", "https://www.google.com/reader/*");
	localStorage["black_list"] = JSON.stringify(blacklist);
  } else {
	blacklist = JSON.parse(localStorage["black_list"]);
  }
  
  var listBox = document.getElementById("listBlack");
  
  for (var j=blacklist.length - 1; j >= 0; j--) {
	var url = blacklist[j];
	var newoption = document.createElement("OPTION");
	newoption.text=url;
	newoption.value=url;
	listBox.add(newoption);
  }
}

// Restores select box state to saved value from localStorage.
function restore_options() {
  var curPro = localStorage["current_protocol"];
  if (!curPro) {
	curPro = localStorage["current_protocol"] = "http";
  }

  var size = document.frm.pro.length;
  for (var i=0; i < size; i++) {
	if (document.frm.pro[i].value == curPro) {
		document.frm.pro[i].checked = true;
	} else {
		document.frm.pro[i].checked = false;
	}
  }
  
  var tab = localStorage["tab_option"];
  if (!tab) {
	tab = localStorage["tab_option"] = "new";
  }

  size = document.frm.tab.length;
  for (var i=0; i < size; i++) {
	if (document.frm.tab[i].value == tab) {
		document.frm.tab[i].checked = true;
	} else {
		document.frm.tab[i].checked = false;
	}
  }
  
  if (localStorage["check_option_interval"] == undefined) {
	localStorage["check_option_interval"] = 120;
  }
  
  document.frm.interval.value = localStorage["check_option_interval"];
  
  restore_blacklist();
}

</script>

<body onload="restore_options()">
   <div id="main">
	  <div id="main-title">
			<img id="icon" src="128.png" width="48" height="48">
			<h3>Thank you for installing Smart RSS Subscriber for Google Reader™</h3>
			<br><br>
			<br><br>
	  </div>
	  <div  class="extension">
<b>Protocol:</b>
<form name="frm">
<input type="radio" name="pro" value="http" onclick="save_options_pro()"/> HTTP<br/>
<input type="radio" name="pro" value="https" onclick="save_options_pro()"/> HTTPS<br/>
<br/>
<b>Tab:</b><br/>
<input type="radio" name="tab" value="new" onclick="save_options_tab()"/> Open a new tab page<br/>
<input type="radio" name="tab" value="current" onclick="save_options_tab()"/> Use current tab page<br/>
<br/>
<b>Check:</b><br/>
Check whether I have subscribed current tab's RSS by Google Accounts if logged in<br/>
Every <input name="interval" value="120" onBlur="save_options_check()" size=4 maxlength=4/> seconds. Input 0 if you don't want to check.<br/>

<br/>
<b>Black List:</b><br/>
Don't check the following websites.<br/>
<input name="addListBlack" style="width:480px"/>&nbsp; <input type="button" value="Add" onclick="add_blacklist_item();"/>
<br/>
<select id="listBlack" name="listBlack" style="width:480px; height:240px" multiple="true">
</select>&nbsp; <input type="button" value="Delete" onclick="del_blacklist_item()"/>
<span id="status" style="color:#ff00ff"/>
</form>
</div>
</div>
</body>
</html>
